clear			all
set 			more off
cd 				"~/Dropbox/Indonesia Migration/" // Specify your root directory here
/*******************************************************************************
				LFP and Unemplyment
********************************************************************************/
use				"Data/Merged", clear
label 			var per_immig_cst_5Y "Population share of new migrants in year t"
label 			var per_immig_cst_5Y_lag "Population share of new migrants in year t-5"

foreach 		var in emp native_emp mig_emp_o mig_emp_n ///
				LFP native_LFP mig_LFP_o mig_LFP_n ///
				unemp native_unemp mig_unemp_o mig_unemp_n {
replace			prop_`var' = prop_`var' * 100
}


/*******************************************************************************
				Multiple lag instrument
********************************************************************************/
quietly ivreg2	prop_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first	
eststo p1
				
quietly ivreg2	prop_native_emp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first	
eststo p2
				
quietly ivreg2	prop_mig_emp_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first	
eststo p3

quietly ivreg2	prop_mig_emp_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first	
eststo p4

coefplot (p1, keep(per_immig_cst_5Y) mcolor(black) offset(-2.6) ciopts(recast(rcap) lcolor(black))) ///
(p1, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-3.4) ciopts(recast(rcap) lcolor(navy))) ///
(p2, keep(per_immig_cst_5Y) mcolor(black) offset(-1.6) ciopts(recast(rcap) lcolor(black))) ///
(p2, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-2.4) ciopts(recast(rcap) lcolor(navy))) ///
(p3, keep(per_immig_cst_5Y) mcolor(black) offset(-0.6) ciopts(recast(rcap) lcolor(black))) ///
(p3, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-1.4) ciopts(recast(rcap) lcolor(navy))) ///
(p4, keep(per_immig_cst_5Y) mcolor(black) offset(0.6) ciopts(recast(rcap) lcolor(black))) ///
(p4, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-0.2) ciopts(recast(rcap) lcolor(navy))), ///
vertical yline(0, lpattern (dash) lcolor(red)) scheme(s1color) /// 
xlabel(-1.5 `" "All" "People" "' -0.5 "Natives" 0.5 `" "Old" "Migrants" "' 1.5 `" "New" "Migrants" "', /// 
noticks labsize(small)) title("{bf:Panel A:} Impact of internal migration on employment", size(small)) xsize(12) ysize(8) /// 
xtitle("Multiple instruments using {it:t-10} migration settlement", size(small)) ///
legend(order(2 "Share of new migrants in year {it:t}" 4 "Share of new migrants in year {it:t-5}")) /// 
graphregion(margin(2 4 2 2)) xscale(r(-2 2) noextend titlegap(2)) yscale(titlegap(2))

graph export "Coefplots/T5_employment_mt10.jpg", as(jpg) name("Graph") quality(100) replace
				
/*******************************************************************************
				Multiple lag instrument
********************************************************************************/
quietly ivreg2	prop_LFP (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first	
eststo p1
				
quietly ivreg2  prop_native_LFP (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first			
eststo p2
				
quietly ivreg2	prop_mig_LFP_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first			
eststo p3

quietly ivreg2	prop_mig_LFP_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first			
eststo p4

coefplot (p1, keep(per_immig_cst_5Y) mcolor(black) offset(-2.6) ciopts(recast(rcap) lcolor(black))) ///
(p1, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-3.4) ciopts(recast(rcap) lcolor(navy))) ///
(p2, keep(per_immig_cst_5Y) mcolor(black) offset(-1.6) ciopts(recast(rcap) lcolor(black))) ///
(p2, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-2.4) ciopts(recast(rcap) lcolor(navy))) ///
(p3, keep(per_immig_cst_5Y) mcolor(black) offset(-0.6) ciopts(recast(rcap) lcolor(black))) ///
(p3, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-1.4) ciopts(recast(rcap) lcolor(navy))) ///
(p4, keep(per_immig_cst_5Y) mcolor(black) offset(0.6) ciopts(recast(rcap) lcolor(black))) ///
(p4, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-0.2) ciopts(recast(rcap) lcolor(navy))), ///
vertical yline(0, lpattern (dash) lcolor(red)) scheme(s1color) /// 
xlabel(-1.5 `" "All" "People" "' -0.5 "Natives" 0.5 `" "Old" "Migrants" "' 1.5 `" "New" "Migrants" "', /// 
noticks labsize(small)) title("{bf:Panel C:} Impact of internal migration on labor force participation", size(small)) xsize(12) ysize(8) /// 
xtitle("Multiple instruments using {it:t-10} migration settlement", size(small)) ///
legend(order(2 "Share of new migrants in year {it:t}" 4 "Share of new migrants in year {it:t-5}")) /// 
graphregion(margin(2 4 2 2)) xscale(r(-2 2) noextend titlegap(2)) yscale(titlegap(2))

graph export "Coefplots/T5_lfp_mt10.jpg", as(jpg) name("Graph") quality(100) replace

/*******************************************************************************
				Multiple lag instrument
********************************************************************************/
quietly ivreg2	prop_unemp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first	
eststo p1
				
quietly ivreg2	prop_native_unemp (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first			
eststo p2
				
quietly ivreg2	prop_mig_unemp_o (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first			
eststo p3

quietly ivreg2	prop_mig_unemp_n (per_immig_cst_5Y per_immig_cst_5Y_lag = ///
				pred_per_immig_cst_10Y_5Y pred_per_immig_cst_Jaeger_10Y) ///
				i.year#i.geolev1 i.geolev2 av_high_educ_ct prop_male_ct av_age_ct ///
				if !inlist(year,2000,2005), cl(geolev2) first			
eststo p4

coefplot (p1, keep(per_immig_cst_5Y) mcolor(black) offset(-2.6) ciopts(recast(rcap) lcolor(black))) ///
(p1, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-3.4) ciopts(recast(rcap) lcolor(navy))) ///
(p2, keep(per_immig_cst_5Y) mcolor(black) offset(-1.6) ciopts(recast(rcap) lcolor(black))) ///
(p2, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-2.4) ciopts(recast(rcap) lcolor(navy))) ///
(p3, keep(per_immig_cst_5Y) mcolor(black) offset(-0.6) ciopts(recast(rcap) lcolor(black))) ///
(p3, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-1.4) ciopts(recast(rcap) lcolor(navy))) ///
(p4, keep(per_immig_cst_5Y) mcolor(black) offset(0.6) ciopts(recast(rcap) lcolor(black))) ///
(p4, keep(per_immig_cst_5Y_lag) msymbol(S) mcolor(navy) offset(-0.2) ciopts(recast(rcap) lcolor(navy))), ///
vertical yline(0, lpattern (dash) lcolor(red)) scheme(s1color) /// 
xlabel(-1.5 `" "All" "People" "' -0.5 "Natives" 0.5 `" "Old" "Migrants" "' 1.5 `" "New" "Migrants" "', /// 
noticks labsize(small)) title("{bf:Panel B:} Impact of internal migration on unemployment", size(small)) xsize(12) ysize(8) /// 
xtitle("Multiple instruments using {it:t-10} migration settlement", size(small)) ///
legend(order(2 "Share of new migrants in year {it:t}" 4 "Share of new migrants in year {it:t-5}")) /// 
graphregion(margin(2 4 2 2)) xscale(r(-2 2) noextend titlegap(2)) yscale(titlegap(2))

graph export "Coefplots/T5_unemployment_mt10.jpg", as(jpg) name("Graph") quality(100) replace

